package com.wzh.controll;

import com.wzh.pojo.Po.Questions;
import com.wzh.service.Personquesser;
import com.wzh.service.Questionser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/question")
public class question {
	@Autowired
	private Questionser questionser;
	@Autowired
	private Personquesser personquesser;
	@GetMapping("/getall")
	@ResponseBody
	public result getall(){

		List<Questions> questions = questionser.getall();
		String mes=questions!=null?"查询成功":"查询失败";
		Integer code=questions!=null?200:300;
		return new result(mes,code,questions);
	};
	@GetMapping("/getsome")
	@ResponseBody
	public result getsome(@RequestParam String drgee){
		System.out.println(drgee);
		List<Questions> questions = questionser.getsome(drgee);
		String mes=questions!=null?"查询成功":"查询失败";
		Integer code=questions!=null?200:300;
		return new result(mes,code,questions);
	};

}
